home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / hypercrd / hc2_x / tcprogud.sit / TC Prog Guide / card_34876.txt < prev    next >
Text File  |  1991-02-27  |  1KB  |  27 lines

  1. -- card: 34876 from stack: in
  2. -- bmap block id: 0
  3. -- flags: 0000
  4. -- background id: 4755
  5. -- name: 
  6.  
  7.  
  8. -- part contents for background part 6
  9. ----- text -----
  10. 8.3  String Handling Functions
  11.  
  12. -- part contents for background part 7
  13. ----- text -----
  14. 194
  15.  
  16. -- part contents for background part 4
  17. ----- text -----
  18. While the language itself provides little assistance with handling character strings, the standard STRING FUNCTIONS (contained in TC's ANSI library) give C programmers the capability to manipulate strings easily.  These functions are declared in string.h:
  19.  
  20.     # include  <string.h>
  21.  
  22. Strings in C are character arrays terminated with the null character '\0'.  Since the name of an array is a pointer to the beginning of the array, most of the standard string functions accept a character pointer as an argument.  A string constant is a sequence of characters enclosed in double quotes.  The null character is provided automatically and the constant is treated as an array name.  Since C does not provide built-in array copying capability, the strcpy() function is used:
  23.  
  24.     char   str1[80];
  25.     strcpy(str1,"Hello, world!");
  26.  
  27. The strcpy() function copies each character of the string pointed to by its second argument to the corresponding element of the string pointed to by its first argument